package net.admin.action;

import java.util.ArrayList;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import net.admin.db.order.OrderBean;
import net.admin.db.order.OrderDAO;


public class OrderDetailAction implements Action {

	@Override
	public ActionForward execute(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		ActionForward af = new ActionForward();
		OrderDAO dao=null;
		ArrayList list = null;
		boolean result=false;
		af.setRedirect(false);
		af.setPath("/admin/order/order_detail.jsp");
		request.setAttribute("requestAction", "OrderDetailAction");
		String order_cd=request.getParameter("order_cd");
		try{
			dao=new OrderDAO();
			OrderBean ob = null;
			ob=dao.getOrderInfo(order_cd);
			list=dao.getArticlesInOrder(order_cd);
			
			request.setAttribute("result", "Y");
			request.setAttribute("order_info", ob);
			request.setAttribute("list", list);
		}catch(Exception e){
			e.printStackTrace();
			result=false;
			request.setAttribute("result", "N");
		}finally{
			dao.close();
		} 
		
		return af;
	}

}
